package com.woniu.product.mapper;

import com.woniu.product.pojo.Product;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.woniu.product.pojo.Product;
import org.apache.ibatis.annotations.Mapper;
import com.woniu.entity.Result;
import com.woniu.product.pojo.Product;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 * 商品表 Mapper 接口
 * </p>
 *
 * @author linxin
 * @since 2023-02-16
 */
public interface ProductMapper extends BaseMapper<Product> {

    boolean queryProductStatus(Long id);
    @Update("update t_product set stock = stock - #{productQuantity} where id = #{id} and stock >= #{productQuantity}")
    int updateStock(@Param("id") String id, @Param("productQuantity") Integer productQuantity);
}
